package Tree;

public class _700_SearchinaBinarySearchTree {
    public TreeNode searchBST(TreeNode root, int val) {
        if(root==null) return null;
        int rval = root.val;
        if (rval > val) {
            return searchBST(root.left,val);
        } else if (rval < val) {
            return searchBST(root.right, val);
        } else {
            return root;
        }
    }
}
